from modelscope import Qwen2_5_VLForConditionalGeneration, AutoTokenizer, AutoProcessor
from qwen_vl_utils import process_vision_info
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from transformers import pipeline
import torch
import single_test
from tqdm import tqdm

test_path = "/home/mbk/rubbish/sen_cls/data/SENTI_RATIONALE/test.tsv"


res = "index	labels	rationals\n"

with open(test_path, 'r') as f:
    data = f.read().split('\n')[1:]
    for line in tqdm(data):
        if len(line) == 0:
            continue
        qid, text_a = tuple(line.split('\t'))
        label, rationals = single_test.predict(text_a)
        # print(text_a)
        # print(label)
        # q = input()
        res += f"{qid}\t{label}\t{rationals}\n"

with open('SENTI_RATIONALE.tsv', 'w') as f:
    f.write(res)
